import http from "@/api/axios";
// 列表
export const getListApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: "/base/biz/bizPreOrderShipment/selectBypage",
    data
  });
};
// 更新运单信息
export const modifyInfoApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: "/base/biz/bizPreOrderShipment/updatePreOrderShipmentById",
    data
  });
};
// 根据预报单ID查询运单
export const getWaybillByPreOderIdApi = (id: string) => {
  return http({
    method: "get",
    url: `/base/biz/bizPreOrderShipment/selectByPreOrderId/${id}`
  });
};
// 标签页 数量统计
export const getPageStaticApi = (data: ClientWaybillManagement.SearchForm) => {
  return http({
    method: "post",
    url: "/base/biz/bizPreOrderShipment/selectPreOrderShipmentCount",
    data
  });
};
// 根据 运单id 获取运单详情
export const getDetailsByIdApi = (id: string) => {
  return http({
    method: "get",
    url: `/base/biz/bizPreOrderShipment/selectByPreOrderShipmentId/${id}`
  });
};
// 运单详情 保存附件
export const keepFileApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: "/base/biz/bizPreOrderShipment/savePreOrderShipmentAnnex",
    data
  });
};
// 获取当前运单 制作发票 草稿
export const getInvoiceDraftApi = (params: { id: string; waybillNum: string }) => {
  return http({
    method: "get",
    url: `/base/biz/preOrderShipmentBox/customer/getDraft`,
    params
  });
};
// 制作发票
export const makeInvoiceApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: "/base/biz/preOrderShipmentBox/customer/addInvoices",
    data
  });
};
// 修改发票
export const modifyInvoiceApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: "/base/biz/preOrderShipmentBox/customer/updateInvoices",
    data
  });
};
// 制作发票 保存草稿
export const saveDraftApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: "/base/biz/preOrderShipmentBox/customer/saveDraft",
    data
  });
};
// 导入发票
export const importInvoiceApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: "/base/biz/excel/importInvoices",
    data,
    headers: {
      "Content-type": "multipart/form-data"
    }
  });
};
// 修改发票-导入发票
export const importInvoiceToModifyApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: "/base/biz/excel/importInvoicesUpdate",
    data,
    headers: {
      "Content-type": "multipart/form-data"
    }
  });
};
// 下载导入发票模板
export const downloadInvoiceTemplateApi = (params: { type: number }) => {
  return http({
    method: "get",
    url: `/base/biz/excel/getImportTemplate`,
    params
  });
};

// 客户端下载导入发票模板
export const customerDownloadInvoiceTemplateApi = (fileName: string) => {
  return http({
    method: "get",
    url: `/base/biz/preOrderShipmentBox/downloadBoxTemplate/${fileName}`,
    responseType: "blob"
  });
};

//批量上传附件
export const bachSavePreOrderShipmentAnnexApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: `/base/biz/bizPreOrderShipment/bachSavePreOrderShipmentAnnex`,
    data
  });
};

//修改运单是否显示客户端的图片
export const updateCustomerPicimgShowApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: `/base/biz/bizPreOrderShipment/updateCustomerPicimgShow`,
    data
  });
};

//是否显示客户图片
export const changeCustomerStatusApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: `/base/biz/bizFileDetail/updateCustomerShow`,
    data
  });
};

// 海外仓 根据 运单id 获取运单详情
export const getWarehouseDetailsByIdApi = (id: string) => {
  return http({
    method: "get",
    url: `/base/biz/bizPreOrderShipment/selectWarehouseByPreOrderShipmentId/${id}`
  });
};
